<?php
declare(strict_types=1);

namespace Modules\Inventory\Http\Controllers;

use Catch\Base\CatchController as Controller;
use Modules\Inventory\Models\InventoryOrderDetail;
use Illuminate\Http\Request;
use Modules\Inventory\Repository\InventoryOrderDetailRepository;


class InventoryOrderDetailController extends Controller
{
    public function __construct(
        protected readonly InventoryOrderDetail $model
    ){}

    /**
     * @param Request $request
     * @return mixed
     */
    public function index(Request $request): mixed
    {
        return InventoryOrderDetailRepository::getList($request->all());
    }

    /**
     * 盘点单明细列表
     * @param Request $request
     * @return mixed
     */
    public function store(Request $request)
    {
        return $this->model->storeBy();
    }

    /**
     * @param $id
     * @return mixed
     */
    public function show($id)
    {
        return $this->model->firstBy($id);
    }

    /**
     * @param Request $request
     * @param $id
     * @return mixed
     */
    public function update($id, Request $request)
    {
        return $this->model->updateBy($id, $request->all());
    }

    /**
     * @param $id
     * @return mixed
     */
    public function destroy($id)
    {
        return $this->model->deleteBy($id);
    }
}
